const INFO_KEY = 'hm_shopping_info'

// 获取用户信息

export const getUserInfo = () => {
  const userInfoStr = localStorage.getItem(INFO_KEY)
  return userInfoStr
    ? JSON.parse(userInfoStr)
    : {
        token: '',
        userId: ''
      }
}

export const setUserInfo = (user) => {
  const userInfoStr = JSON.stringify(user)
  localStorage.setItem(INFO_KEY, userInfoStr)
}

export const removeUserInfo = () => {
  localStorage.removeItem(INFO_KEY)
}
